<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.0</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    {{template "header.html" .}}
</head>

<body>
<div class="x-body">
    <form class="layui-form" id="form-data" action="">

        <div class="layui-form-item">
            <label for="MenuName" class="layui-form-label">
                <span class="x-red">*</span>菜单名字
            </label>
            <div class="layui-input-inline">
                <input type="text" id="MenuName" name="MenuName" value="{{.MenuRow.MenuName}}" required="required" lay-verify="MenuName" autocomplete="off" class="layui-input" width="500px">
            </div>
        </div>

        <div class="layui-form-item">
            <label for="MenuRootid" class="layui-form-label">
                上级菜单
            </label>
            <div class="layui-input-inline">
                <select id="MenuRootid" name="MenuRootid" class="valid">
                    <option value="0">请选择...</option>
                    {{range $key,$value := .MenuList}}
                        {{if eq $value.MenuLevel 1}}
                           <option value="{{$value.Id}}" {{if eq $.MenuRow.MenuRootid $value.Id}} selected="selected" {{end}} >{{$value.MenuName}}</option>
                        {{else}}
                           <option value="{{$value.Id}}" {{if eq $.MenuRow.MenuRootid $value.Id}} selected="selected" {{end}} >&nbsp;&nbsp;&nbsp;&nbsp;
                               ├{{$value.MenuName}}</option>
                        {{end}}
                    {{end}}
                </select>
            </div>

            <div class="layui-form-mid layui-word-aux"></div>
        </div>

        <div class="layui-form-item">
            <label for="MenuUrl" class="layui-form-label">
                菜单地址
            </label>
            <div class="layui-input-inline">
                <input type="text" id="MenuUrl" name="MenuUrl" required="" lay-verify=""
                       autocomplete="off" class="layui-input" value="{{$.MenuRow.MenuUrl}}" placeholder="">
            </div>
            <div class="layui-form-mid layui-word-aux">例: SysMenuController.GetSysMenuList</div>
        </div>

        <div class="layui-form-item">
            <label for="MenuLevel" class="layui-form-label">
                菜单层级
            </label>
            <div class="layui-input-inline">
                <input type="text" id="MenuLevel" name="MenuLevel" required="" lay-verify=""
                       autocomplete="off" class="layui-input" value="{{$.MenuRow.MenuLevel}}" placeholder="">
            </div>
            <div class="layui-form-mid layui-word-aux"></div>
        </div>


        <div class="layui-form-item">
            <label for="MenuIcon" class="layui-form-label">
                菜单图标
            </label>
            <div class="layui-input-inline">
                <input type="text" id="MenuIcon" name="MenuIcon" required="" lay-verify=""
                       autocomplete="off" class="layui-input" value="{{$.MenuRow.MenuIcon}}">
            </div>
            <div class="layui-form-mid layui-word-aux">顶级菜单图标</div>
        </div>

        <div class="layui-form-item layui-form-text">
            <label for="MenuFuncs" class="layui-form-label">
                菜单方法
            </label>
            <div class="layui-input-block">
                <textarea placeholder="格式为Json" rows="15" id="MenuFuncs" name="MenuFuncs" class="layui-textarea">{{$.MenuRow.MenuFuncs}}</textarea>
                <pre class="layui-code">
[
  {
    "func_id": 1,
    "func_name": "GetSysRoleListByPage",
    "func_desc": "菜单列表"
  }
]
            </pre>
            </div>
        </div>


        <div class="layui-form-item">
            <label class="layui-form-label" for="MenuStatus">
                菜单状态
            </label>
            <div class="layui-input-inline layui-form-checkbox" style="border: 0px;padding-top: 3px;">
                <input type="checkbox" name="MenuStatus" id="MenuStatus" lay-skin="switch" lay-text="ON|OFF"
                {{if eq $.MenuRow.MenuStatus  1}}
                 checked="checked"
                {{end}}
                 value="{{$.MenuRow.MenuStatus}}" lay-filter="Status"
                >
                <div class="layui-unselect layui-form-switch" lay-skin="_switch"><em>OFF</em><i></i></div>
            </div>
        </div>

        <input type="hidden" value="{{$.MenuRow.Id}}" id="Id" name="Id">

        <div class="layui-form-item">
            <label for="L_repass" class="layui-form-label">
            </label>
            <button  class="layui-btn" lay-filter="sub" lay-submit="">
                提交
            </button>
        </div>

</form>
</div>
<script>
    layui.use(['form','layer'], function(){
        var form = layui.form
        var layer = layui.layer

        form.on('submit(sub)', function(data){
            var loading = layer.load(1, {shade: [0.1,'#fff']});
            formSubmit('{{urlfor "SysMenuController.SaveSysMenu"}}', $("#form-data").serialize(),"alert","reload")
            layer.close(loading);
            return false
        })
    })
</script>

</body>

</html>